home *** CD-ROM | disk | FTP | other *** search
- /* NeoGeoPocket Rom Tool by */
- /* Fabrizio "Lanch" Bartoloni */
- /* lanch@tiscalinet.it */
- /* Neo Geo Pocket is copyright and trademark of SNK */
- /*
- Thanks to: Tomasz Slanina dox@dc-s.com
- */
-
-
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
-
- #define LICENCE 29
- #define START_ADDRESS 4
- #define CART_ID_CODE 0x20L
- #define CART_VERSION 0x21L
- #define SYSTEM_CODE 6
- #define MONOCHROME 0x00L
- #define COLOR 0x10L
- #define CART_TITLE 12
-
- static char verstr[] = "$VER: NGPtool 0.9 (06.08.02)";
-
- int main(int argc, char **argv)
- {
- FILE *fp, *fd;
-
- char buf[LICENCE];
- char start[START_ADDRESS];
- char sys_code[SYSTEM_CODE];
- char title[CART_TITLE];
- int idcode;
- int version;
- int mode;
- long offset;
-
- if (argc != 3)
- {
- fprintf(stderr, " Usage: %s rom.ngp rominfo.txt \n", argv[0]);
- fprintf(stderr, " © 2002 Fabrizio 'Lanch' Bartoloni \n");
- fprintf(stderr, " lanch@tiscalinet.it \n");
- exit(1);
- }
-
- fp = fopen(argv[1],"rb");
- if (!fp)
- {
- fprintf(stderr, "Unable to open file: %s\n", argv[1]);
- exit(1);
- }
-
-
- offset = 0x0000L;
- fseek(fp,offset,0);
- fgets(buf, sizeof(buf), fp);
- fd = fopen(argv[2], "w");
- if (!fd)
- {
- fprintf(stderr," Unable to create %s\n", argv[2]);
- exit(1);
- }
- fprintf(fd, " About %s :\n\n", argv[1]);
- fprintf(fd," Licence: %s\n", buf);
- fseek(fp,0x1EL,0);
- fgets(start, sizeof(start), fp);
- fprintf(fd," Start Address: to be fixed! %s\n", start);
- fseek(fp,CART_ID_CODE,0);
- idcode = fgetc(fp);
- fprintf(fd," Cartridge Id Code: %d\n", idcode);
- fseek(fp,CART_VERSION,0);
- version = fgetc(fp);
- fprintf(fd," Cartridge version: %d\n", version);
- fseek(fp,0x22L,0);
- mode = fgetc(fp);
- if (mode == MONOCHROME)
- {
- strcpy(sys_code, "monoc");
- }
- else if (mode == COLOR)
- {
- strcpy(sys_code, "color");
- }
- else {
- strcpy(sys_code, "wrong");
- }
- fprintf(fd," Cartridge System Code: %s\n", sys_code);
- fseek(fp, 0x23L,0);
- fgets(title, sizeof(title), fp);
- fprintf(fd," Cart Title: %s\n", title);
- exit(0);
-
- fclose(fd);
- fclose(fp);
- return(0);
- }
-